import 'package:flutter/cupertino.dart';
import 'package:get/get_navigation/src/routes/observers/route_observer.dart';

class MyNavigatorObserver extends GetObserver {
  static String lastRouteName = '';
  //需要一个计时器，只针对重复进入同一个页面
  @override
  void didPop(Route route, Route? previousRoute) {
    // MyNavigatorObserver.lastRouteName = route.settings.name!;
    // refresh();
    // print("页面从 ${route.settings.name} 返回到了 ${previousRoute?.settings.name}");
    super.didPop(route, previousRoute);
  }



  refresh() async {
    //这个时间由getx框架决定。直到getx将页面相关的controller清除之后才可再次进入（问题是怎么才能监听到controller的清除进度）
    // await Future.delayed(Duration(seconds: 1));
    // MyNavigatorObserver.lastRouteName = '';
  }



  @override
  void didReplace({Route? newRoute, Route? oldRoute}) {

  }
}
